/**
 * 用户相关接口
 */
import request from "../utils/request";

// 定义 API 路径常量
const API_INDEX_LOGIN = '/artificial/cashier/index/login';
const API_INDEX_INIT = "/artificial/cashier/index/init";
const API_INDEX_QUIT = "/artificial/cashier/index/quit";
const API_INDEX_DATA = "/artificial/cashier/index/data"

type LoginParams = {
};

type InitParams = {
  code: string;
};

/**
 * 登录
 * @param params 登录请求参数
 */
export const login = (params: LoginParams) => {
  return request.post(API_INDEX_LOGIN, params);
};

/**
 * 初始化
 */
export const init = () => {
  const params: InitParams = { code: 'vX7kYhyEVqOcFWJn' };
  return request.post(API_INDEX_INIT, params);
};

/**
 * 登出 => 交班
 */
export const logout = () => {
  const params: InitParams = { code: 'vX7kYhyEVqOcFWJn' };
  return request.post(API_INDEX_QUIT, params);
};

/**
 * 获取交班数据
 */
export const getData = () => {
  const params: InitParams = { code: 'vX7kYhyEVqOcFWJn' };
  return request.post(API_INDEX_DATA, params);
};